//
//  CommonFunc.h
//  BarCode
//
//  Created by Dale on 17/4/5.
//  Copyright © 2017年 MobileArtisan. All rights reserved.
//

#import <Foundation/Foundation.h>

//检测是否4寸屏
#define is35inch    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640.0, 960.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define is40inch    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640.0, 1136.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define is47inch    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750.0, 1334.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define is55inch    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242.0, 2208.0), [[UIScreen mainScreen] currentMode].size) : NO)
//从nib中加载cell
#define LoadFromNib(nibName)  [[[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil] lastObject]

//frame相关
#define SetFrameByXPos(frame,xpos)        {CGRect rect = frame; rect.origin.x = xpos; frame = rect;}
#define SetFrameByYPos(frame,ypos)        {CGRect rect = frame; rect.origin.y = ypos; frame = rect;}
#define SetFrameByWidth(frame,kWidth)     {CGRect rect = frame; rect.size.width = kWidth; frame = rect;}
#define SetFrameByHeight(frame,kHeight)   {CGRect rect = frame; rect.size.height = kHeight; frame = rect;}

//Window相关
#define Screen_Width                 [UIScreen mainScreen].bounds.size.width
#define Screen_Height                [UIScreen mainScreen].bounds.size.height

//弧度与角度的转换
#define DegreeToRadian(X)            ((X) * M_PI / 180.0)
#define RadianToDegree(Radian)       ((Radian) * 180.0 / M_PI)

//View相关
#define Point(Xpos, Ypos)                  CGPointMake(Xpos, Ypos)
#define Size(Width, Height)                CGSizeMake(Width, Height)
#define Frame(Xpos, Ypos, Width, Height)   CGRectMake(Xpos, Ypos, Width, Height)
#define Xpos                               origin.x
#define Ypos                               origin.y
#define Width                              size.width
#define Height                             size.height


////最小线宽
#define minLineWidth  (1.0 / [UIScreen mainScreen].scale)

#define SingletonApplication         [UIApplication sharedApplication]

//设置View圆角
#define setViewCorner(view,radius)   {view.layer.cornerRadius = radius; view.layer.masksToBounds = YES;}
//app 当前的版本
#define AppVersion  [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//NSString *serviceVersion;

typedef void(^HandleBlock)(id results, int status);

@interface CommonFunc : NSObject

+ (BOOL)isEmptyString:(NSString *)sourceStr;

//MARK:- request network
+ (void)getUsersWithResult:(HandleBlock)block;

+ (void)bind:(NSString *)userName FullName:(NSString *)fullName Code:(NSString *)code GoodsName:(NSString *)goodsName Block:(HandleBlock)block;

+ (void)findGoodsName:(NSString *)code Block:(HandleBlock)block;

+(void)modifyPasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword block:(HandleBlock)block;

+ (BOOL)validateWithStartTime:(NSString *)startTime withExpireTime:(NSString *)expireTime withTiem:(NSString *)time;

@end
